package com.design.pattern.designPrinciples.dependenceInversion;

/**
 * create by yufeng on 2021/7/3 10:33
 */
public class DipTest {
    public static void main(String[] args) {
//       ============= v1 依赖细节 如果哪天又要学其他课程 那么调用方（this）和被调用方（XiaoMing）都要修改============
//        XiaoMing xiaoMing = new XiaoMing();
//        xiaoMing.studyCCourse();
//        xiaoMing.studyJavaCourse();

//       ============= v2 依赖抽象============
//        XiaoMing xiaoMing = new XiaoMing();
//        xiaoMing.study(new JavaCourse());
//        xiaoMing.study(new CCourse());

//       ============= v3 如果XiaoMing 是单例的话这样也不妥============
//        XiaoMing xiaoMing = new XiaoMing(new JavaCourse());
//        xiaoMing.study();
//
//        XiaoMing xiaoMing1 = new XiaoMing(new CCourse());
//        xiaoMing1.study();

//       ============= v4============
        XiaoMing xiaoMing = new XiaoMing();
        xiaoMing.setCourse(new JavaCourse());
        xiaoMing.study();
        xiaoMing.setCourse(new CCourse());
        xiaoMing.study();
    }
}
